<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../assets/js/vue.js"></script>
    <style>
        .container{
            width: 240px;
            display: flex;
            justify-content: space-between;
            margin: 50px;
            font-size: 20px;
        }
        .slider{
            width: 60px;
            height: 26px;
            line-height: 26px;
            border-radius: 26px;
            background-color: #dcdfe6;
            cursor: pointer;
        }
        .slider>div{
            width: 22px;
            height: 22px;
            line-height: 24px;
            border-radius: 24px;
            background-color: white;
            margin: 2px;
        }
        .colorfont{
            color:#409eff
        }
        .colorbg{
            background-color:#409eff
        }
        .move{
            margin-left:37px !important;
            transition: all  500ms ease-in-out;
        }
        .back{
            margin-left:1px !important;
            transition: all  500ms ease-in-out;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="container">
            <div :class="flag?'colorfont':''">按年付费</div>
            <div class="slider" :class="flag?'':'colorbg'" @click="flag=!flag"> 
                    <div :class="flag?'back':'move'"></div>
            </div>
            <div :class="flag?'':'colorfont'">按月付费</div>
        </div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                  flag:false  
            },
            methods: {
            },
        })
    </script>
</body>
</html>